Contemporary computer systems require large memories, and consequently, memory management is essential to increasing system performance. Memory in computers can be broadly classified as main memory and virtual memory. Main memory is the physical memory, the memory chips or disk drives or other storage media. Locations in main memory have addresses that correspond to actual locations on the memory device, and the system processor can directly and rapidly access those locations. The virtual memory address space is a programming construct, designed to facilitate memory management by program developers by abstracting logical memory addresses from physical locations. The virtual memory space can be considerably larger than the available RAM, and it is allocated to programs in contiguous blocks. As a program runs, the virtual memory system moves data among fixed storage locations (generally on hard disk, flash memory or the like), RAM, caches, and temporary storage locations on a fixed storage device, swapping data from location to location as needed. Logical memory addresses must be mapped to the physical memory locations where the data actually reside, and the virtual memory system accomplishes this task in a manner transparent to the programmer.
Virtual memory is divided into pages of a size chosen based on the capabilities of the system environment. During program operation, data is moved between wherever it resides in fixed storage (on a hard disk or CD-ROM, for example) into RAM, and that movement is done in page-sized blocks. The data may not reside in a contiguous block in fixed storage, and it may not be loaded into a contiguous block in RAM, but the application program only deals with virtual memory addresses, leaving mappings to wherever the data is physically located to the system. Addresses are “translated” by the system from virtual to main memory.
Because data is moved in page sized blocks, the page size itself directly affects system efficiency. If the page size is small, but data requirements are large, for example larger than the page size, the number of data read and data write operations will be multiplied. Conversely, if the page size is considerably larger than typical data requirements, then more memory will be allocated to each operation than is required. Both situations produce inefficiency, and the art has responded by employing multiple page sizes, so that an application may be able to use 4K, 64K and 16M pages, for example, depending on the needs of a particular application.
Multiple page sizing has been implemented in many systems by introducing segmentation, which allows division of the memory address space into larger blocks of varying size, segments, which contain pages of equal size. This technique provides improved flexibility, particularly while multitasking, but it also creates some new issues. In particular, segmentation introduced another level of memory address abstraction, requiring further address translation. Thus, multiple page sizing increases the task of allocating and employing the physical memory, and errors in that process can lead to memory collisions, in which several running applications could lose data. The Operating System must avert such situations by avoiding conflicting address translations with any other page size in the segment. Consequently, a computer system with a virtual memory, which supports multiple page sizes in a segment, is required to manage addresses during address translations efficiently.